<?php
session_start();
?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<?php

include('conn.php');

$mk = md5($_POST['pwd']);
$tk = $_POST['username'];

$query = "select * from sinh_vien where MSSV = '$tk' and MAT_KHAU = '$mk'";
$result = mysql_query($query, $conn) or die(mysql_error());

/*
// Kiem tra tai khoan
$check = 0;
while ($row = mysql_fetch_array($result))
{
	$check = 1;
}
*/

// Dem so dong ket qua truy van
$count = mysql_num_rows($result);

// Dong ket noi
mysql_close();

if ($count == 1)
{
	$_SESSION['taikhoan'] = $_POST['username'];
	$_SESSION["acctype"] = "sv";
	header("Location: ../View/sv_cpanel.php");
}

else
{
	header("Location: ../View/sv_login.php?error=true");
}

?>